//
//  RadioView.m
//  Car
//
//  Created by 何晓文 on 15/9/17.
//  Copyright (c) 2015年 朱鸿儒. All rights reserved.
//

#import "RadioView.h"



#define kwhite [UIColor whiteColor]
@implementation RadioView

- (instancetype)initWithFrame:(CGRect)frame {

	if (self = [super initWithFrame:frame]) {
		
		
		//节目图片
		self.programPic = [[UIImageView alloc] initWithFrame:CGRectMake((kWidth - kHeight * 250 / 667) / 2, 80, kHeight * 250 / 667, kHeight * 250 / 667)];
		[self.programPic setImage:[UIImage imageNamed:@"ic_launcher_music"]];
		self.programPic.backgroundColor = kwhite;
		[self setUpimageView:self.programPic];
		[self addSubview:self.programPic];
		//节目标题
		self.TitleLabel = [[UILabel alloc] initWithFrame:CGRectMake((kWidth - 200) / 2,self.programPic.height + 110, 200, 25)];
		self.TitleLabel.textAlignment = NSTextAlignmentCenter;
		self.TitleLabel.font = [UIFont systemFontOfSize:15];
		[self addSubview:self.TitleLabel];
		//节目专辑
		self.AlbumLabel = [[UILabel alloc] initWithFrame:CGRectMake((kWidth - 120) / 2, self.TitleLabel.frame.origin.y + 35, 120, 25)];
		self.AlbumLabel.textAlignment = NSTextAlignmentCenter;
		self.AlbumLabel.font = [UIFont systemFontOfSize:13];
		[self addSubview:self.AlbumLabel];
		
		//节目时间
		self.programTime = [[UILabel alloc] initWithFrame:CGRectMake((kWidth - 150) / 2, self.programPic.frame.origin.y + kHeight * 250 / 667 + 5, 150, 30)];
		self.programTime.textAlignment = NSTextAlignmentCenter;
		self.programTime.font = [UIFont systemFontOfSize:15];
		[self addSubview:self.programTime];
		
		//播放按钮
		self.startButton = [UIButton buttonWithType:(UIButtonTypeCustom)];
		[self.startButton setImage:[UIImage imageNamed:@"ic_play"] forState:(UIControlStateNormal)];
		self.startButton.frame = CGRectMake((kWidth - 75) / 2  , self.AlbumLabel.frame.origin.y + 30, 75, 75) ;

		[self addSubview:self.startButton];
		
		//节目菜单
		self.programList = [UIButton buttonWithType:(UIButtonTypeCustom)];
		self.programList.frame = CGRectMake(kWidth / 5 - 50 + 25, self.startButton.frame.origin.y + 25 / 2, 40, 40);
		[self.programList setImage:[UIImage imageNamed:@"ic_list"] forState:(UIControlStateNormal)];

		[self addSubview:self.programList];
		
		//互动按钮
		self.moreButton = [ UIButton buttonWithType:(UIButtonTypeCustom)];
		self.moreButton.frame = CGRectMake(kWidth - kWidth * 1/ 5 - 25, self.startButton.frame.origin.y + 25 / 2, 50, 50);
		[self.moreButton setImage:[UIImage imageNamed:@"dannormal"] forState:(UIControlStateNormal)];
		[self addSubview:self.moreButton];
		
		self.backgroundColor = [UIColor clearColor];
		
	}
	
	return self;
}

- (void)setUpimageView:(UIImageView *)imageView {
	imageView.userInteractionEnabled = YES;
	//允许设置
	imageView.layer.masksToBounds = YES;
	imageView.layer.borderWidth = 2;
	imageView.layer.cornerRadius = imageView.bounds.size.height / 2;
	imageView.layer.borderColor = [[UIColor whiteColor] CGColor];
	
	
}
@end
